🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / NodeManager.kt
Displaying Raw • Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/NodeManager.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 3.96 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.meshtastic.core.model.MyNodeInfo
Tff7b72import T7ee787org.meshtastic.core.model.Node
Tff7b72import T7ee787org.meshtastic.core.model.util.NodeIdLookup
Tff7b72import T7ee787org.meshtastic.proto.DeviceMetadata
Tff7b72import T7ee787org.meshtastic.proto.FirmwareEdition
Tff7b72import T7ee787org.meshtastic.proto.Paxcount
Tff7b72import T7ee787org.meshtastic.proto.StatusMessage
Tff7b72import T7ee787org.meshtastic.proto.Telemetry
Tff7b72import T7ee787org.meshtastic.proto.User
Tff7b72import T7ee787org.meshtastic.proto.NodeInfo Tff7b72as Te6edf3ProtoNodeInfo
Tff7b72import T7ee787org.meshtastic.proto.Position Tff7b72as Te6edf3ProtoPosition
T8b949e/** Interface for managing the in-memory node database and processing received node information. */
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffTooManyFunctionsTa5d6ff"Tb4b4b4)
Tff7b72interface T56d364NodeManager Tb4b4b4: Te6edf3NodeIdLookup Tb4b4b4{
T8b949e/** Reactive map of all nodes by their number. */
Tff7b72val Te6edf3nodeDBbyNodeNumTb4b4b4: Te6edf3MapTff7b72<Tffa657IntTb4b4b4, Te6edf3NodeTff7b72>
T8b949e/** Look up a node by its user ID string (e.g. `"!a1b2c3d4"`). */
Tff7b72fun Td2a8ffgetNodeByIdTb4b4b4(Te6edf3idTb4b4b4: Tffa657StringTb4b4b4)Tb4b4b4: Te6edf3Node?
T8b949e/** Whether the node database is ready. */
Tff7b72val Te6edf3isNodeDbReadyTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72>
T8b949e/** Sets whether the node database is ready. */
Tff7b72fun Td2a8ffsetNodeDbReadyTb4b4b4(Te6edf3readyTb4b4b4: Tffa657BooleanTb4b4b4)
T8b949e/** Whether node database writes are allowed. */
Tff7b72val Te6edf3allowNodeDbWritesTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72>
T8b949e/** Sets whether node database writes are allowed. */
Tff7b72fun Td2a8ffsetAllowNodeDbWritesTb4b4b4(Te6edf3allowedTb4b4b4: Tffa657BooleanTb4b4b4)
T8b949e/** The local node number as a thread-safe [StateFlow]. */
Tff7b72val Te6edf3myNodeNumTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657Int?Tff7b72>
T8b949e/** Sets the local node number. */
Tff7b72fun Td2a8ffsetMyNodeNumTb4b4b4(Te6edf3numTb4b4b4: Tffa657Int?Tb4b4b4)
T8b949e/** The firmware edition reported by the connected device. */
Tff7b72val Te6edf3firmwareEditionTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3FirmwareEdition?Tff7b72>
T8b949e/** Sets the firmware edition of the connected device. */
Tff7b72fun Td2a8ffsetFirmwareEditionTb4b4b4(Te6edf3editionTb4b4b4: Te6edf3FirmwareEdition?Tb4b4b4)
T8b949e/** Loads the cached node database from the repository. */
Tff7b72fun Td2a8ffloadCachedNodeDBTb4b4b4(Tb4b4b4)
T8b949e/** Clears the in-memory node database. */
Tff7b72fun Td2a8ffclearTb4b4b4(Tb4b4b4)
T8b949e/** Returns information about the local node. */
Tff7b72fun Td2a8ffgetMyNodeInfoTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3MyNodeInfo?
T8b949e/** Returns the local node ID. */
Tff7b72fun Td2a8ffgetMyIdTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657String
T8b949e/** Processes a received user packet. */
Tff7b72fun Td2a8ffhandleReceivedUserTb4b4b4(Te6edf3fromNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3pTb4b4b4: Te6edf3UserTb4b4b4, Te6edf3channelTb4b4b4: Tffa657Int Tff7b72= T79c0ff0Tb4b4b4, Te6edf3manuallyVerifiedTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4)
T8b949e/** Processes a received position packet. */
Tff7b72fun Td2a8ffhandleReceivedPositionTb4b4b4(Te6edf3fromNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3myNodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3pTb4b4b4: Te6edf3ProtoPositionTb4b4b4, Te6edf3defaultTimeTb4b4b4: Tffa657LongTb4b4b4)
T8b949e/** Processes a received telemetry packet. */
Tff7b72fun Td2a8ffhandleReceivedTelemetryTb4b4b4(Te6edf3fromNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3telemetryTb4b4b4: Te6edf3TelemetryTb4b4b4)
T8b949e/** Processes a received paxcounter packet. */
Tff7b72fun Td2a8ffhandleReceivedPaxcounterTb4b4b4(Te6edf3fromNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3pTb4b4b4: Te6edf3PaxcountTb4b4b4)
T8b949e/** Processes a received node status message. */
Tff7b72fun Td2a8ffhandleReceivedNodeStatusTb4b4b4(Te6edf3fromNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3sTb4b4b4: Te6edf3StatusMessageTb4b4b4)
T8b949e/** Updates the status string for a node. */
Tff7b72fun Td2a8ffupdateNodeStatusTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3statusTb4b4b4: Tffa657String?Tb4b4b4)
T8b949e/** Updates a node using a transformation function. */
Tff7b72fun Td2a8ffupdateNodeTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3channelTb4b4b4: Tffa657Int Tff7b72= T79c0ff0Tb4b4b4, Te6edf3transformTb4b4b4: Tb4b4b4(Te6edf3NodeTb4b4b4) Tff7b72-Tff7b72> Te6edf3NodeTb4b4b4)
T8b949e/** Removes a node from the in-memory database by its number. */
Tff7b72fun Td2a8ffremoveByNodenumTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Installs node information from a ProtoNodeInfo object. */
Tff7b72fun Td2a8ffinstallNodeInfoTb4b4b4(Te6edf3infoTb4b4b4: Te6edf3ProtoNodeInfoTb4b4b4)
T8b949e/** Inserts hardware metadata for a node. */
Tff7b72fun Td2a8ffinsertMetadataTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3metadataTb4b4b4: Te6edf3DeviceMetadataTb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s